opencode-antigravity-auth-mf 1.3.0-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +630 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +3 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/antigravity/oauth.d.ts +31 -0
  8. package/dist/src/antigravity/oauth.d.ts.map +1 -0
  9. package/dist/src/antigravity/oauth.js +168 -0
  10. package/dist/src/antigravity/oauth.js.map +1 -0
  11. package/dist/src/constants.d.ts +99 -0
  12. package/dist/src/constants.d.ts.map +1 -0
  13. package/dist/src/constants.js +135 -0
  14. package/dist/src/constants.js.map +1 -0
  15. package/dist/src/hooks/auto-update-checker/cache.d.ts +3 -0
  16. package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
  17. package/dist/src/hooks/auto-update-checker/cache.js +71 -0
  18. package/dist/src/hooks/auto-update-checker/cache.js.map +1 -0
  19. package/dist/src/hooks/auto-update-checker/checker.d.ts +16 -0
  20. package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
  21. package/dist/src/hooks/auto-update-checker/checker.js +237 -0
  22. package/dist/src/hooks/auto-update-checker/checker.js.map +1 -0
  23. package/dist/src/hooks/auto-update-checker/constants.d.ts +9 -0
  24. package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
  25. package/dist/src/hooks/auto-update-checker/constants.js +23 -0
  26. package/dist/src/hooks/auto-update-checker/constants.js.map +1 -0
  27. package/dist/src/hooks/auto-update-checker/index.d.ts +34 -0
  28. package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -0
  29. package/dist/src/hooks/auto-update-checker/index.js +125 -0
  30. package/dist/src/hooks/auto-update-checker/index.js.map +1 -0
  31. package/dist/src/hooks/auto-update-checker/types.d.ts +25 -0
  32. package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -0
  33. package/dist/src/hooks/auto-update-checker/types.js +1 -0
  34. package/dist/src/hooks/auto-update-checker/types.js.map +1 -0
  35. package/dist/src/plugin/accounts.d.ts +86 -0
  36. package/dist/src/plugin/accounts.d.ts.map +1 -0
  37. package/dist/src/plugin/accounts.js +609 -0
  38. package/dist/src/plugin/accounts.js.map +1 -0
  39. package/dist/src/plugin/auth.d.ts +21 -0
  40. package/dist/src/plugin/auth.d.ts.map +1 -0
  41. package/dist/src/plugin/auth.js +46 -0
  42. package/dist/src/plugin/auth.js.map +1 -0
  43. package/dist/src/plugin/cache/index.d.ts +5 -0
  44. package/dist/src/plugin/cache/index.d.ts.map +1 -0
  45. package/dist/src/plugin/cache/index.js +5 -0
  46. package/dist/src/plugin/cache/index.js.map +1 -0
  47. package/dist/src/plugin/cache/signature-cache.d.ts +111 -0
  48. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -0
  49. package/dist/src/plugin/cache/signature-cache.js +375 -0
  50. package/dist/src/plugin/cache/signature-cache.js.map +1 -0
  51. package/dist/src/plugin/cache.d.ts +44 -0
  52. package/dist/src/plugin/cache.d.ts.map +1 -0
  53. package/dist/src/plugin/cache.js +200 -0
  54. package/dist/src/plugin/cache.js.map +1 -0
  55. package/dist/src/plugin/cli.d.ts +19 -0
  56. package/dist/src/plugin/cli.d.ts.map +1 -0
  57. package/dist/src/plugin/cli.js +59 -0
  58. package/dist/src/plugin/cli.js.map +1 -0
  59. package/dist/src/plugin/config/index.d.ts +16 -0
  60. package/dist/src/plugin/config/index.d.ts.map +1 -0
  61. package/dist/src/plugin/config/index.js +16 -0
  62. package/dist/src/plugin/config/index.js.map +1 -0
  63. package/dist/src/plugin/config/loader.d.ts +37 -0
  64. package/dist/src/plugin/config/loader.d.ts.map +1 -0
  65. package/dist/src/plugin/config/loader.js +206 -0
  66. package/dist/src/plugin/config/loader.js.map +1 -0
  67. package/dist/src/plugin/config/schema.d.ts +411 -0
  68. package/dist/src/plugin/config/schema.d.ts.map +1 -0
  69. package/dist/src/plugin/config/schema.js +339 -0
  70. package/dist/src/plugin/config/schema.js.map +1 -0
  71. package/dist/src/plugin/core/streaming/index.d.ts +3 -0
  72. package/dist/src/plugin/core/streaming/index.d.ts.map +1 -0
  73. package/dist/src/plugin/core/streaming/index.js +3 -0
  74. package/dist/src/plugin/core/streaming/index.js.map +1 -0
  75. package/dist/src/plugin/core/streaming/transformer.d.ts +10 -0
  76. package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -0
  77. package/dist/src/plugin/core/streaming/transformer.js +255 -0
  78. package/dist/src/plugin/core/streaming/transformer.js.map +1 -0
  79. package/dist/src/plugin/core/streaming/types.d.ts +35 -0
  80. package/dist/src/plugin/core/streaming/types.d.ts.map +1 -0
  81. package/dist/src/plugin/core/streaming/types.js +1 -0
  82. package/dist/src/plugin/core/streaming/types.js.map +1 -0
  83. package/dist/src/plugin/debug.d.ts +68 -0
  84. package/dist/src/plugin/debug.d.ts.map +1 -0
  85. package/dist/src/plugin/debug.js +325 -0
  86. package/dist/src/plugin/debug.js.map +1 -0
  87. package/dist/src/plugin/errors.d.ts +28 -0
  88. package/dist/src/plugin/errors.d.ts.map +1 -0
  89. package/dist/src/plugin/errors.js +42 -0
  90. package/dist/src/plugin/errors.js.map +1 -0
  91. package/dist/src/plugin/image-saver.d.ts +25 -0
  92. package/dist/src/plugin/image-saver.d.ts.map +1 -0
  93. package/dist/src/plugin/image-saver.js +86 -0
  94. package/dist/src/plugin/image-saver.js.map +1 -0
  95. package/dist/src/plugin/logger.d.ts +54 -0
  96. package/dist/src/plugin/logger.d.ts.map +1 -0
  97. package/dist/src/plugin/logger.js +120 -0
  98. package/dist/src/plugin/logger.js.map +1 -0
  99. package/dist/src/plugin/project.d.ts +33 -0
  100. package/dist/src/plugin/project.d.ts.map +1 -0
  101. package/dist/src/plugin/project.js +234 -0
  102. package/dist/src/plugin/project.js.map +1 -0
  103. package/dist/src/plugin/recovery/constants.d.ts +22 -0
  104. package/dist/src/plugin/recovery/constants.d.ts.map +1 -0
  105. package/dist/src/plugin/recovery/constants.js +43 -0
  106. package/dist/src/plugin/recovery/constants.js.map +1 -0
  107. package/dist/src/plugin/recovery/index.d.ts +12 -0
  108. package/dist/src/plugin/recovery/index.d.ts.map +1 -0
  109. package/dist/src/plugin/recovery/index.js +12 -0
  110. package/dist/src/plugin/recovery/index.js.map +1 -0
  111. package/dist/src/plugin/recovery/storage.d.ts +24 -0
  112. package/dist/src/plugin/recovery/storage.d.ts.map +1 -0
  113. package/dist/src/plugin/recovery/storage.js +354 -0
  114. package/dist/src/plugin/recovery/storage.js.map +1 -0
  115. package/dist/src/plugin/recovery/types.d.ts +116 -0
  116. package/dist/src/plugin/recovery/types.d.ts.map +1 -0
  117. package/dist/src/plugin/recovery/types.js +6 -0
  118. package/dist/src/plugin/recovery/types.js.map +1 -0
  119. package/dist/src/plugin/recovery.d.ts +61 -0
  120. package/dist/src/plugin/recovery.d.ts.map +1 -0
  121. package/dist/src/plugin/recovery.js +376 -0
  122. package/dist/src/plugin/recovery.js.map +1 -0
  123. package/dist/src/plugin/refresh-queue.d.ts +101 -0
  124. package/dist/src/plugin/refresh-queue.d.ts.map +1 -0
  125. package/dist/src/plugin/refresh-queue.js +244 -0
  126. package/dist/src/plugin/refresh-queue.js.map +1 -0
  127. package/dist/src/plugin/request-helpers.d.ts +278 -0
  128. package/dist/src/plugin/request-helpers.d.ts.map +1 -0
  129. package/dist/src/plugin/request-helpers.js +2268 -0
  130. package/dist/src/plugin/request-helpers.js.map +1 -0
  131. package/dist/src/plugin/request.d.ts +91 -0
  132. package/dist/src/plugin/request.d.ts.map +1 -0
  133. package/dist/src/plugin/request.js +1302 -0
  134. package/dist/src/plugin/request.js.map +1 -0
  135. package/dist/src/plugin/rotation.d.ts +168 -0
  136. package/dist/src/plugin/rotation.d.ts.map +1 -0
  137. package/dist/src/plugin/rotation.js +302 -0
  138. package/dist/src/plugin/rotation.js.map +1 -0
  139. package/dist/src/plugin/server.d.ts +23 -0
  140. package/dist/src/plugin/server.d.ts.map +1 -0
  141. package/dist/src/plugin/server.js +324 -0
  142. package/dist/src/plugin/server.js.map +1 -0
  143. package/dist/src/plugin/storage.d.ts +92 -0
  144. package/dist/src/plugin/storage.d.ts.map +1 -0
  145. package/dist/src/plugin/storage.js +417 -0
  146. package/dist/src/plugin/storage.js.map +1 -0
  147. package/dist/src/plugin/stores/signature-store.d.ts +5 -0
  148. package/dist/src/plugin/stores/signature-store.d.ts.map +1 -0
  149. package/dist/src/plugin/stores/signature-store.js +25 -0
  150. package/dist/src/plugin/stores/signature-store.js.map +1 -0
  151. package/dist/src/plugin/thinking-recovery.d.ts +90 -0
  152. package/dist/src/plugin/thinking-recovery.d.ts.map +1 -0
  153. package/dist/src/plugin/thinking-recovery.js +316 -0
  154. package/dist/src/plugin/thinking-recovery.js.map +1 -0
  155. package/dist/src/plugin/token.d.ts +19 -0
  156. package/dist/src/plugin/token.d.ts.map +1 -0
  157. package/dist/src/plugin/token.js +128 -0
  158. package/dist/src/plugin/token.js.map +1 -0
  159. package/dist/src/plugin/transform/claude.d.ts +80 -0
  160. package/dist/src/plugin/transform/claude.d.ts.map +1 -0
  161. package/dist/src/plugin/transform/claude.js +265 -0
  162. package/dist/src/plugin/transform/claude.js.map +1 -0
  163. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +35 -0
  164. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
  165. package/dist/src/plugin/transform/cross-model-sanitizer.js +225 -0
  166. package/dist/src/plugin/transform/cross-model-sanitizer.js.map +1 -0
  167. package/dist/src/plugin/transform/gemini.d.ts +112 -0
  168. package/dist/src/plugin/transform/gemini.d.ts.map +1 -0
  169. package/dist/src/plugin/transform/gemini.js +409 -0
  170. package/dist/src/plugin/transform/gemini.js.map +1 -0
  171. package/dist/src/plugin/transform/index.d.ts +15 -0
  172. package/dist/src/plugin/transform/index.d.ts.map +1 -0
  173. package/dist/src/plugin/transform/index.js +14 -0
  174. package/dist/src/plugin/transform/index.js.map +1 -0
  175. package/dist/src/plugin/transform/model-resolver.d.ts +101 -0
  176. package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -0
  177. package/dist/src/plugin/transform/model-resolver.js +356 -0
  178. package/dist/src/plugin/transform/model-resolver.js.map +1 -0
  179. package/dist/src/plugin/transform/types.d.ts +106 -0
  180. package/dist/src/plugin/transform/types.d.ts.map +1 -0
  181. package/dist/src/plugin/transform/types.js +1 -0
  182. package/dist/src/plugin/transform/types.js.map +1 -0
  183. package/dist/src/plugin/types.d.ts +96 -0
  184. package/dist/src/plugin/types.d.ts.map +1 -0
  185. package/dist/src/plugin/types.js +1 -0
  186. package/dist/src/plugin/types.js.map +1 -0
  187. package/dist/src/plugin/usage-reporter.d.ts +23 -0
  188. package/dist/src/plugin/usage-reporter.d.ts.map +1 -0
  189. package/dist/src/plugin/usage-reporter.js +43 -0
  190. package/dist/src/plugin/usage-reporter.js.map +1 -0
  191. package/dist/src/plugin.d.ts +8 -0
  192. package/dist/src/plugin.d.ts.map +1 -0
  193. package/dist/src/plugin.js +1708 -0
  194. package/dist/src/plugin.js.map +1 -0
  195. package/package.json +67 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jens
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,630 @@
1
+ # Antigravity + Gemini CLI OAuth Plugin for Opencode
2
+
3
+ [![npm version](https://img.shields.io/npm/v/opencode-antigravity-auth.svg)](https://www.npmjs.com/package/opencode-antigravity-auth)
4
+ [![npm beta](https://img.shields.io/npm/v/opencode-antigravity-auth/beta.svg?label=beta)](https://www.npmjs.com/package/opencode-antigravity-auth)
5
+ [![npm downloads](https://img.shields.io/npm/dw/opencode-antigravity-auth.svg)](https://www.npmjs.com/package/opencode-antigravity-auth)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
+ [![X (Twitter)](https://img.shields.io/badge/X-@dopesalmon-000000?style=flat&logo=x)](https://x.com/dopesalmon)
8
+
9
+ Enable Opencode to authenticate against **Antigravity** (Google's IDE) via OAuth so you can use Antigravity rate limits and access models like `gemini-3-pro` and `claude-opus-4-5-thinking` with your Google credentials.
10
+
11
+ ## What You Get
12
+
13
+ - **Claude Opus 4.5, Sonnet 4.5** and **Gemini 3 Pro/Flash** via Google OAuth
14
+ - **Multi-account support** — add multiple Google accounts, auto-rotates when rate-limited
15
+ - **Dual quota system** — access both Antigravity and Gemini CLI quotas from one plugin
16
+ - **Thinking models** — extended thinking for Claude and Gemini 3 with configurable budgets
17
+ - **Google Search grounding** — enable web search for Gemini models (auto or always-on)
18
+ - **Auto-recovery** — handles session errors and tool failures automatically
19
+ - **Plugin compatible** — works alongside other OpenCode plugins (oh-my-opencode, dcp, etc.)
20
+
21
+ ---
22
+
23
+ ## Installation
24
+
25
+ <details open>
26
+ <summary><b>For Humans</b></summary>
27
+
28
+ **Option A: Let an LLM do it**
29
+
30
+ Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
31
+
32
+ ```
33
+ Install the opencode-antigravity-auth plugin and add the Antigravity model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/dev/README.md
34
+ ```
35
+
36
+ **Option B: Manual setup**
37
+
38
+ 1. **Add the plugin** to `~/.config/opencode/opencode.json`:
39
+
40
+ ```json
41
+ {
42
+ "plugin": ["opencode-antigravity-auth@latest"]
43
+ }
44
+ ```
45
+
46
+ > Want bleeding-edge features? Use `opencode-antigravity-auth@beta` instead.
47
+
48
+ 2. **Login** with your Google account:
49
+
50
+ ```bash
51
+ opencode auth login
52
+ ```
53
+
54
+ 3. **Add models** — copy the [full configuration](#models) below
55
+
56
+ 4. **Use it:**
57
+
58
+ ```bash
59
+ opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5-thinking --variant=max
60
+ ```
61
+
62
+ </details>
63
+
64
+ <details>
65
+ <summary><b>For LLM Agents</b></summary>
66
+
67
+ ### Step-by-Step Instructions
68
+
69
+ 1. Edit the OpenCode configuration file at `~/.config/opencode/opencode.json`
70
+
71
+ > **Note**: This path works on all platforms. On Windows, `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
72
+
73
+ 2. Add the plugin to the `plugin` array
74
+
75
+ 3. Add the model definitions from the [Full models configuration](#models) section
76
+
77
+ 4. Set `provider` to `"google"` and choose a model
78
+
79
+ ### Verification
80
+
81
+ ```bash
82
+ opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5-thinking --variant=max
83
+ ```
84
+
85
+ </details>
86
+
87
+ ---
88
+
89
+ ## Models
90
+
91
+ ### Model Reference
92
+
93
+ **Antigravity quota** (Claude + Gemini 3):
94
+
95
+ | Model | Variants | Notes |
96
+ |-------|----------|-------|
97
+ | `antigravity-gemini-3-pro` | low, high | Gemini 3 Pro with thinking |
98
+ | `antigravity-gemini-3-flash` | minimal, low, medium, high | Gemini 3 Flash with thinking |
99
+ | `antigravity-claude-sonnet-4-5` | — | Claude Sonnet 4.5 |
100
+ | `antigravity-claude-sonnet-4-5-thinking` | low, max | Claude Sonnet with extended thinking |
101
+ | `antigravity-claude-opus-4-5-thinking` | low, max | Claude Opus with extended thinking |
102
+
103
+ **Gemini CLI quota** (separate from Antigravity):
104
+
105
+ | Model | Notes |
106
+ |-------|-------|
107
+ | `gemini-2.5-flash` | Gemini 2.5 Flash |
108
+ | `gemini-2.5-pro` | Gemini 2.5 Pro |
109
+ | `gemini-3-flash-preview` | Gemini 3 Flash (preview) |
110
+ | `gemini-3-pro-preview` | Gemini 3 Pro (preview) |
111
+
112
+ **Using variants:**
113
+ ```bash
114
+ opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5-thinking --variant=max
115
+ ```
116
+
117
+ For details on variant configuration and thinking levels, see [docs/MODEL-VARIANTS.md](docs/MODEL-VARIANTS.md).
118
+
119
+ <details>
120
+ <summary><b>Full models configuration (copy-paste ready)</b></summary>
121
+
122
+ Add this to your `~/.config/opencode/opencode.json`:
123
+
124
+ ```json
125
+ {
126
+ "$schema": "https://opencode.ai/config.json",
127
+ "plugin": ["opencode-antigravity-auth@latest"],
128
+ "provider": {
129
+ "google": {
130
+ "models": {
131
+ "antigravity-gemini-3-pro": {
132
+ "name": "Gemini 3 Pro (Antigravity)",
133
+ "limit": { "context": 1048576, "output": 65535 },
134
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
135
+ "variants": {
136
+ "low": { "thinkingLevel": "low" },
137
+ "high": { "thinkingLevel": "high" }
138
+ }
139
+ },
140
+ "antigravity-gemini-3-flash": {
141
+ "name": "Gemini 3 Flash (Antigravity)",
142
+ "limit": { "context": 1048576, "output": 65536 },
143
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
144
+ "variants": {
145
+ "minimal": { "thinkingLevel": "minimal" },
146
+ "low": { "thinkingLevel": "low" },
147
+ "medium": { "thinkingLevel": "medium" },
148
+ "high": { "thinkingLevel": "high" }
149
+ }
150
+ },
151
+ "antigravity-claude-sonnet-4-5": {
152
+ "name": "Claude Sonnet 4.5 (Antigravity)",
153
+ "limit": { "context": 200000, "output": 64000 },
154
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
155
+ },
156
+ "antigravity-claude-sonnet-4-5-thinking": {
157
+ "name": "Claude Sonnet 4.5 Thinking (Antigravity)",
158
+ "limit": { "context": 200000, "output": 64000 },
159
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
160
+ "variants": {
161
+ "low": { "thinkingConfig": { "thinkingBudget": 8192 } },
162
+ "max": { "thinkingConfig": { "thinkingBudget": 32768 } }
163
+ }
164
+ },
165
+ "antigravity-claude-opus-4-5-thinking": {
166
+ "name": "Claude Opus 4.5 Thinking (Antigravity)",
167
+ "limit": { "context": 200000, "output": 64000 },
168
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
169
+ "variants": {
170
+ "low": { "thinkingConfig": { "thinkingBudget": 8192 } },
171
+ "max": { "thinkingConfig": { "thinkingBudget": 32768 } }
172
+ }
173
+ },
174
+ "gemini-2.5-flash": {
175
+ "name": "Gemini 2.5 Flash (Gemini CLI)",
176
+ "limit": { "context": 1048576, "output": 65536 },
177
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
178
+ },
179
+ "gemini-2.5-pro": {
180
+ "name": "Gemini 2.5 Pro (Gemini CLI)",
181
+ "limit": { "context": 1048576, "output": 65536 },
182
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
183
+ },
184
+ "gemini-3-flash-preview": {
185
+ "name": "Gemini 3 Flash Preview (Gemini CLI)",
186
+ "limit": { "context": 1048576, "output": 65536 },
187
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
188
+ },
189
+ "gemini-3-pro-preview": {
190
+ "name": "Gemini 3 Pro Preview (Gemini CLI)",
191
+ "limit": { "context": 1048576, "output": 65535 },
192
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
193
+ }
194
+ }
195
+ }
196
+ }
197
+ }
198
+ ```
199
+
200
+ </details>
201
+
202
+ ---
203
+
204
+ ## Multi-Account Setup
205
+
206
+ Add multiple Google accounts for higher combined quotas. The plugin automatically rotates between accounts when one is rate-limited.
207
+
208
+ ```bash
209
+ opencode auth login # Run again to add more accounts
210
+ ```
211
+
212
+ For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
213
+
214
+ ---
215
+
216
+ ## Troubleshoot
217
+
218
+ > **Quick Reset**: Most issues can be resolved by deleting `~/.config/opencode/antigravity-accounts.json` and running `opencode auth login` again.
219
+
220
+ ### Configuration Path (All Platforms)
221
+
222
+ OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
223
+
224
+ | File | Path |
225
+ |------|------|
226
+ | Main config | `~/.config/opencode/opencode.json` |
227
+ | Accounts | `~/.config/opencode/antigravity-accounts.json` |
228
+ | Plugin config | `~/.config/opencode/antigravity.json` |
229
+ | Debug logs | `~/.config/opencode/antigravity-logs/` |
230
+
231
+ > **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`). Do NOT use `%APPDATA%`.
232
+
233
+ ---
234
+
235
+ ### Multi-Account Auth Issues
236
+
237
+ If you encounter authentication issues with multiple accounts:
238
+
239
+ 1. Delete the accounts file:
240
+ ```bash
241
+ rm ~/.config/opencode/antigravity-accounts.json
242
+ ```
243
+ 2. Re-authenticate:
244
+ ```bash
245
+ opencode auth login
246
+ ```
247
+
248
+ ---
249
+
250
+ ### 403 Permission Denied (`rising-fact-p41fc`)
251
+
252
+ **Error:**
253
+ ```
254
+ Permission 'cloudaicompanion.companions.generateChat' denied on resource
255
+ '//cloudaicompanion.googleapis.com/projects/rising-fact-p41fc/locations/global'
256
+ ```
257
+
258
+ **Cause:** Plugin falls back to a default project ID when no valid project is found. This works for Antigravity but fails for Gemini CLI models.
259
+
260
+ **Solution:**
261
+ 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
262
+ 2. Create or select a project
263
+ 3. Enable the **Gemini for Google Cloud API** (`cloudaicompanion.googleapis.com`)
264
+ 4. Add `projectId` to your accounts file:
265
+ ```json
266
+ {
267
+ "accounts": [
268
+ {
269
+ "email": "your@email.com",
270
+ "refreshToken": "...",
271
+ "projectId": "your-project-id"
272
+ }
273
+ ]
274
+ }
275
+ ```
276
+
277
+ > **Note**: Do this for each account in a multi-account setup.
278
+
279
+ ---
280
+
281
+ ### Gemini Model Not Found
282
+
283
+ Add this to your `google` provider config:
284
+
285
+ ```json
286
+ {
287
+ "provider": {
288
+ "google": {
289
+ "npm": "@ai-sdk/google",
290
+ "models": { ... }
291
+ }
292
+ }
293
+ }
294
+ ```
295
+
296
+ ---
297
+
298
+ ### Gemini 3 Models 400 Error ("Unknown name 'parameters'")
299
+
300
+ **Error:**
301
+ ```
302
+ Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]'
303
+ ```
304
+
305
+ **Causes:**
306
+ - Tool schema incompatibility with Gemini's strict protobuf validation
307
+ - MCP servers with malformed schemas
308
+ - Plugin version regression
309
+
310
+ **Solutions:**
311
+ 1. **Update to latest beta:**
312
+ ```json
313
+ { "plugin": ["opencode-antigravity-auth@beta"] }
314
+ ```
315
+
316
+ 2. **Disable MCP servers** one-by-one to find the problematic one
317
+
318
+ 3. **Add npm override:**
319
+ ```json
320
+ { "provider": { "google": { "npm": "@ai-sdk/google" } } }
321
+ ```
322
+
323
+ ---
324
+
325
+ ### MCP Servers Causing Errors
326
+
327
+ Some MCP servers have schemas incompatible with Antigravity's strict JSON format.
328
+
329
+ **Diagnosis:**
330
+ 1. Disable all MCP servers in your config
331
+ 2. Enable one-by-one until error reappears
332
+ 3. Report the specific MCP in a [GitHub issue](https://github.com/NoeFabris/opencode-antigravity-auth/issues)
333
+
334
+ ---
335
+
336
+ ### "All Accounts Rate-Limited" (But Quota Available)
337
+
338
+ **Cause:** Cascade bug in `clearExpiredRateLimits()` in hybrid mode (fixed in recent beta).
339
+
340
+ **Solutions:**
341
+ 1. Update to latest beta version
342
+ 2. If persists, delete accounts file and re-authenticate
343
+ 3. Try switching `account_selection_strategy` to `"sticky"` in `antigravity.json`
344
+
345
+ ---
346
+
347
+ ### Session Recovery
348
+
349
+ If you encounter errors during a session:
350
+ 1. Type `continue` to trigger the recovery mechanism
351
+ 2. If blocked, use `/undo` to revert to pre-error state
352
+ 3. Retry the operation
353
+
354
+ ---
355
+
356
+ ### Using with Oh-My-OpenCode
357
+
358
+ **Important:** Disable the built-in Google auth to prevent conflicts:
359
+
360
+ ```json
361
+ // ~/.config/opencode/oh-my-opencode.json
362
+ {
363
+ "google_auth": false,
364
+ "agents": {
365
+ "frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3-pro" },
366
+ "document-writer": { "model": "google/antigravity-gemini-3-flash" }
367
+ }
368
+ }
369
+ ```
370
+
371
+ ---
372
+
373
+ ### Infinite `.tmp` Files Created
374
+
375
+ **Cause:** When account is rate-limited and plugin retries infinitely, it creates many temp files.
376
+
377
+ **Workaround:**
378
+ 1. Stop OpenCode
379
+ 2. Clean up: `rm ~/.config/opencode/*.tmp`
380
+ 3. Add more accounts or wait for rate limit to expire
381
+
382
+ ---
383
+
384
+ ### OAuth Callback Issues
385
+
386
+ <details>
387
+ <summary><b>Safari OAuth Callback Fails (macOS)</b></summary>
388
+
389
+ **Symptoms:**
390
+ - "fail to authorize" after successful Google login
391
+ - Safari shows "Safari can't open the page"
392
+
393
+ **Cause:** Safari's "HTTPS-Only Mode" blocks `http://localhost` callback.
394
+
395
+ **Solutions:**
396
+
397
+ 1. **Use Chrome or Firefox** (easiest):
398
+ Copy the OAuth URL and paste into a different browser.
399
+
400
+ 2. **Disable HTTPS-Only Mode temporarily:**
401
+ - Safari > Settings (⌘,) > Privacy
402
+ - Uncheck "Enable HTTPS-Only Mode"
403
+ - Run `opencode auth login`
404
+ - Re-enable after authentication
405
+
406
+ </details>
407
+
408
+ <details>
409
+ <summary><b>Port Conflict (Address Already in Use)</b></summary>
410
+
411
+ **macOS / Linux:**
412
+ ```bash
413
+ # Find process using the port
414
+ lsof -i :51121
415
+
416
+ # Kill if stale
417
+ kill -9 <PID>
418
+
419
+ # Retry
420
+ opencode auth login
421
+ ```
422
+
423
+ **Windows (PowerShell):**
424
+ ```powershell
425
+ netstat -ano | findstr :51121
426
+ taskkill /PID <PID> /F
427
+ opencode auth login
428
+ ```
429
+
430
+ </details>
431
+
432
+ <details>
433
+ <summary><b>Docker / WSL2 / Remote Development</b></summary>
434
+
435
+ OAuth callback requires browser to reach `localhost` on the machine running OpenCode.
436
+
437
+ **WSL2:**
438
+ - Use VS Code's port forwarding, or
439
+ - Configure Windows → WSL port forwarding
440
+
441
+ **SSH / Remote:**
442
+ ```bash
443
+ ssh -L 51121:localhost:51121 user@remote
444
+ ```
445
+
446
+ **Docker / Containers:**
447
+ - OAuth with localhost redirect doesn't work in containers
448
+ - Wait 30s for manual URL flow, or use SSH port forwarding
449
+
450
+ </details>
451
+
452
+ ---
453
+
454
+ ### Configuration Key Typo: `plugin` not `plugins`
455
+
456
+ The correct key is `plugin` (singular):
457
+
458
+ ```json
459
+ {
460
+ "plugin": ["opencode-antigravity-auth@beta"]
461
+ }
462
+ ```
463
+
464
+ **Not** `"plugins"` (will cause "Unrecognized key" error).
465
+
466
+ ---
467
+
468
+ ### Migrating Accounts Between Machines
469
+
470
+ When copying `antigravity-accounts.json` to a new machine:
471
+ 1. Ensure the plugin is installed: `"plugin": ["opencode-antigravity-auth@beta"]`
472
+ 2. Copy `~/.config/opencode/antigravity-accounts.json`
473
+ 3. If you get "API key missing" error, the refresh token may be invalid — re-authenticate
474
+
475
+ ## Known Plugin Interactions
476
+ For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
477
+
478
+ ---
479
+
480
+ ## Plugin Compatibility
481
+
482
+ ### @tarquinen/opencode-dcp
483
+
484
+ DCP creates synthetic assistant messages that lack thinking blocks. **List this plugin BEFORE DCP:**
485
+
486
+ ```json
487
+ {
488
+ "plugin": [
489
+ "opencode-antigravity-auth@latest",
490
+ "@tarquinen/opencode-dcp@latest"
491
+ ]
492
+ }
493
+ ```
494
+
495
+ ### oh-my-opencode
496
+
497
+ Disable built-in auth and override agent models in `oh-my-opencode.json`:
498
+
499
+ ```json
500
+ {
501
+ "google_auth": false,
502
+ "agents": {
503
+ "frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3-pro" },
504
+ "document-writer": { "model": "google/antigravity-gemini-3-flash" },
505
+ "multimodal-looker": { "model": "google/antigravity-gemini-3-flash" }
506
+ }
507
+ }
508
+ ```
509
+
510
+ > **Tip:** When spawning parallel subagents, enable `pid_offset_enabled: true` in `antigravity.json` to distribute sessions across accounts.
511
+
512
+ ### Plugins you don't need
513
+
514
+ - **gemini-auth plugins** — Not needed. This plugin handles all Google OAuth.
515
+
516
+ ---
517
+
518
+ ## Configuration
519
+
520
+ Create `~/.config/opencode/antigravity.json` for optional settings:
521
+
522
+ ```json
523
+ {
524
+ "$schema": "https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/assets/antigravity.schema.json"
525
+ }
526
+ ```
527
+
528
+ Most users don't need to configure anything — defaults work well.
529
+
530
+ ### Model Behavior
531
+
532
+ | Option | Default | What it does |
533
+ |--------|---------|--------------
534
+ | `keep_thinking` | `false` | Preserve Claude's thinking across turns. **Warning:** enabling may degrade model stability. |
535
+ | `session_recovery` | `true` | Auto-recover from tool errors |
536
+ | `web_search.default_mode` | `"off"` | Gemini Google Search: `"auto"` or `"off"` |
537
+
538
+ ### Account Rotation
539
+
540
+ | Your Setup | Recommended Config |
541
+ |------------|-------------------|
542
+ | **1 account** | `"account_selection_strategy": "sticky"` |
543
+ | **2-5 accounts** | Default (`"hybrid"`) works great |
544
+ | **5+ accounts** | `"account_selection_strategy": "round-robin"` |
545
+ | **Parallel agents** | Add `"pid_offset_enabled": true` |
546
+
547
+ ### App Behavior
548
+
549
+ | Option | Default | What it does |
550
+ |--------|---------|--------------|
551
+ | `quiet_mode` | `false` | Hide toast notifications |
552
+ | `debug` | `false` | Enable debug logging |
553
+ | `auto_update` | `true` | Auto-update plugin |
554
+
555
+ For all options, see [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
556
+
557
+ **Environment variables:**
558
+ ```bash
559
+ OPENCODE_ANTIGRAVITY_DEBUG=1 opencode # Enable debug logging
560
+ OPENCODE_ANTIGRAVITY_DEBUG=2 opencode # Verbose logging
561
+ ```
562
+
563
+ ---
564
+
565
+ ## Troubleshooting
566
+
567
+ See the full [Troubleshooting Guide](docs/TROUBLESHOOTING.md) for solutions to common issues including:
568
+
569
+ - Auth problems and token refresh
570
+ - "Model not found" errors
571
+ - Session recovery
572
+ - Gemini CLI permission errors
573
+ - Safari OAuth issues
574
+ - Plugin compatibility
575
+ - Migration guides
576
+
577
+ ---
578
+
579
+ ## Documentation
580
+
581
+ - [Configuration](docs/CONFIGURATION.md) — All configuration options
582
+ - [Multi-Account](docs/MULTI-ACCOUNT.md) — Load balancing, dual quota pools, account storage
583
+ - [Model Variants](docs/MODEL-VARIANTS.md) — Thinking budgets and variant system
584
+ - [Troubleshooting](docs/TROUBLESHOOTING.md) — Common issues and fixes
585
+ - [Architecture](docs/ARCHITECTURE.md) — How the plugin works
586
+ - [API Spec](docs/ANTIGRAVITY_API_SPEC.md) — Antigravity API reference
587
+
588
+ ---
589
+
590
+ ## Support
591
+
592
+ If this plugin helps you, consider supporting its maintenance:
593
+
594
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/S6S81QBOIR)
595
+
596
+ ---
597
+
598
+ ## Credits
599
+
600
+ - [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) by [@jenslys](https://github.com/jenslys)
601
+ - [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)
602
+
603
+ ## License
604
+
605
+ MIT License. See [LICENSE](LICENSE) for details.
606
+
607
+ <details>
608
+ <summary><b>Legal</b></summary>
609
+
610
+ ### Intended Use
611
+
612
+ - Personal / internal development only
613
+ - Respect internal quotas and data handling policies
614
+ - Not for production services or bypassing intended limits
615
+
616
+ ### Warning
617
+
618
+ By using this plugin, you acknowledge:
619
+
620
+ - **Terms of Service risk** — This approach may violate ToS of AI model providers
621
+ - **Account risk** — Providers may suspend or ban accounts
622
+ - **No guarantees** — APIs may change without notice
623
+ - **Assumption of risk** — You assume all legal, financial, and technical risks
624
+
625
+ ### Disclaimer
626
+
627
+ - Not affiliated with Google. This is an independent open-source project.
628
+ - "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
629
+
630
+ </details>
@@ -0,0 +1,4 @@
1
+ export { AntigravityCLIOAuthPlugin, GoogleOAuthPlugin, } from "./src/plugin";
2
+ export { authorizeAntigravity, exchangeAntigravity, } from "./src/antigravity/oauth";
3
+ export type { AntigravityAuthorization, AntigravityTokenExchangeResult, } from "./src/antigravity/oauth";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,yBAAyB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { AntigravityCLIOAuthPlugin, GoogleOAuthPlugin, } from "./src/plugin";
2
+ export { authorizeAntigravity, exchangeAntigravity, } from "./src/antigravity/oauth";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Result returned to the caller after constructing an OAuth authorization URL.
3
+ */
4
+ export interface AntigravityAuthorization {
5
+ url: string;
6
+ verifier: string;
7
+ projectId: string;
8
+ }
9
+ interface AntigravityTokenExchangeSuccess {
10
+ type: "success";
11
+ refresh: string;
12
+ access: string;
13
+ expires: number;
14
+ email?: string;
15
+ projectId: string;
16
+ }
17
+ interface AntigravityTokenExchangeFailure {
18
+ type: "failed";
19
+ error: string;
20
+ }
21
+ export type AntigravityTokenExchangeResult = AntigravityTokenExchangeSuccess | AntigravityTokenExchangeFailure;
22
+ /**
23
+ * Build the Antigravity OAuth authorization URL including PKCE and optional project metadata.
24
+ */
25
+ export declare function authorizeAntigravity(projectId?: string): Promise<AntigravityAuthorization>;
26
+ /**
27
+ * Exchange an authorization code for Antigravity CLI access and refresh tokens.
28
+ */
29
+ export declare function exchangeAntigravity(code: string, state: string): Promise<AntigravityTokenExchangeResult>;
30
+ export {};
31
+ //# sourceMappingURL=oauth.d.ts.map